#region
/* Adoor.NET - Object/Relational mapping framework leveraging ADO.NET`s powerful disconnected mode.
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *  
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *  
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */ 
#endregion

using System;
using System.Collections.Generic;
using System.Data;

namespace Adoor.Relational
{
	public enum ExpressionKind { Select, Delete, Count, Aggregate };
	public delegate void QueryEventHandler(object sender, QueryEventArgs e);

	public class QueryEventArgs: EventArgs
	{
		public QueryEventArgs(RelationalQuery query, ExpressionKind kind)
		{
			this.query = query;
			this.kind = kind;
		}

		public RelationalQuery Query
		{
			get { return this.query; }
			set { this.query = value; }
		}

		public ExpressionKind Kind
		{
			get { return this.kind; }
			set { this.kind = value; }
		}

		private RelationalQuery query;
		private ExpressionKind kind;
	}

	public interface IRelationalSource
	{
		/// <summary>
		///  Give a chance to optimize the query
		/// </summary>
		event QueryEventHandler OnQuery;
		void ExecuteDelete(RelationalOperator op, System.Collections.ICollection args);
        void ExecuteNonQuery(RelationalQuery query, System.Collections.ICollection args);
		void ExecuteNonQuery(RelationalQuery query, IDictionary<string, object> args);
        Int64 ExecuteCount(RelationalQuery query, System.Collections.ICollection args);
        IDataReader ExecuteReader(RelationalQuery query, System.Collections.ICollection args);
		void Fill(RelationalQuery query, System.Collections.ICollection args, DataSet dataset);
        void Fill(RelationalQuery query, System.Collections.ICollection args, DataSet dataset, string tablename);
        void Fill(RelationalQuery query, System.Collections.ICollection args, DataTable datatable);
		void Fill(RelationalQuery query, IDictionary<string, object> args, DataTable datatable);
		void Fill(RelationalQuery query, object args, DataTable datatable);
        object GetScalar(RelationalQuery query, System.Collections.ICollection args);		
	}
}